@model PagedList.IPagedList<ShivamEMR.Model.Domain.DoctorsDomain.Doctor>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>

@using (Html.BeginForm())
{
    <p>
        Find by Code/Name: @Html.TextBox("SearchString")  
        <input type="submit" value="Search" /></p>
}

<table>
    <tr>
        <th></th>
      
        <th>
           Name
        </th>
       
       
        <th>
            CurrentBranches
        </th>
        <th>
            Designations
        </th>
        <th>
            Appointments
        </th>
        
        <th>
            Specialties
        </th>
       
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
            @Html.ActionLink("Details", "Details", new { id=item.ID }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.ID })
        </td>
       
        <td>
			@item.FullName
        </td>
       
        <td>
			@(item.CurrentBranches == null ? "None" : item.CurrentBranches.Count.ToString())
        </td>
        <td>
			@(item.Designations == null ? "None" : item.Designations.Count.ToString())
        </td>
        <td>
			@(item.Appointments == null ? "None" : item.Appointments.Count.ToString())
        </td>
        
       
        <td>
			@(item.Specialties == null ? "None" : item.Specialties.Count.ToString())
        </td>
      
    </tr>
}

</table>


<div>
    Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    of @Model.PageCount
     
    @if (Model.HasPreviousPage)
    {
        @Html.ActionLink("<<", "Index", new { page = 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
        @Html.Raw(" ");
        @Html.ActionLink("< Prev", "Index", new { page = Model.PageNumber - 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
    }
    else
    {
        @:<<
        @Html.Raw(" ");
        @:< Prev
    }
     
    @if (Model.HasNextPage)
    {
        @Html.ActionLink("Next >", "Index", new { page = Model.PageNumber + 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
        @Html.Raw(" ");
        @Html.ActionLink(">>", "Index", new { page = Model.PageCount, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
    }
    else
    {
        @:Next >
        @Html.Raw(" ")
        @:>>
    }
</div>